Skip to content

tonic-build: match trait_attribute against full service name - #3102

Open
nathanielford wants to merge 1 commit into
grpc:masterfrom
nathanielford:fix/trait-attribute-service-name
Open

nathanielford wants to merge 1 commit into
grpc:masterfrom
nathanielford:fix/trait-attribute-service-name

Conversation

@nathanielford

Copy link
Copy Markdown
Contributor

Motivation

Fixes #2341.

trait_attribute matches against the unqualified service.name(), so package-qualified paths like "myservice.MyService" silently fail to apply, unlike server_attribute and client_attribute.

Solution

Pass the package-qualified service name from format_service_name to attributes.for_trait instead of unqualified service.name(), matching server_attribute and client_attribute. Unqualified service names still match via suffix matching.

Adds unit tests covering package-qualified and unqualified matches.

Pass the package-qualified service name from `format_service_name` to
`attributes.for_trait` instead of unqualified `service.name()`, matching
`server_attribute` and `client_attribute`. Unqualified service names
still match via suffix matching.

Adds unit tests covering package-qualified and unqualified matches.

Fixes grpc#2341.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support for customizing trait attributes in tonic-build

2 participants